package com.briup.jz.service.impl;

import com.briup.jz.bean.BasePrivilege;
import com.briup.jz.bean.CertificationApply;
import com.briup.jz.dao.BasePrivilegeMapper;
import com.briup.jz.dao.CertificationApplyMapper;
import com.briup.jz.service.IBasePrivilegeService;
import com.briup.jz.utils.CustomerException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class BasePrivilegeServiceImpl implements IBasePrivilegeService {


    //依赖注入
    @Resource
    private BasePrivilegeMapper basePrivilegeMapper;

    @Override
    public void saveOrUpdat(BasePrivilege basePrivilege) throws CustomerException {


        if (basePrivilege.getId()!=null){
            //更新操作
            basePrivilegeMapper.updateByPrimaryKey(basePrivilege);
        }else {
            basePrivilegeMapper.insert(basePrivilege);
        }
    }

    @Override
    public BasePrivilege query(Long id) {

       return basePrivilegeMapper.selectByPrimaryKey(id);
    }

    @Override
    public void deleteById(Long id) throws CustomerException {

        basePrivilegeMapper.deleteByPrimaryKey(id);
    }
}
